home *** CD-ROM | disk | FTP | other *** search
- class Heroes.Timer extends MovieClip
- {
- var currentTime_lz;
- var myIntervalID;
- var currentTime = 0;
- var warningTime = 10;
- function Timer()
- {
- super();
- }
- function addTime(extraTime)
- {
- if(this.currentTime != 0)
- {
- §§push(this.play());
- }
- this.currentTime += extraTime;
- this.currentTime_lz.setNumber(this.currentTime);
- }
- function setTime(newTime)
- {
- this.currentTime = newTime;
- this.currentTime_lz.setNumber(this.currentTime);
- }
- function getTime()
- {
- return this.currentTime;
- }
- function start()
- {
- this.tick();
- this.myIntervalID = setInterval(this,"tick",1000);
- }
- function stop()
- {
- clearInterval(this.myIntervalID);
- }
- function tick()
- {
- this.currentTime = this.currentTime - 1;
- this.currentTime_lz.setNumber(this.currentTime);
- if(this.currentTime == this.warningTime)
- {
- this._parent.level.follower.playSound("comeontimesticking");
- }
- if(this.currentTime == 0)
- {
- this._parent.level.player.stopRespondingToUser();
- this._parent.outOfTime.gotoAndStop("show");
- §§push(this.stop());
- }
- }
- }
-